package com.mdc.mansion.core.modules.system.impl;

import com.mdc.mansion.common.util.DateUtils;
import com.mdc.mansion.core.modules.system.SysLogService;
import com.mdc.mansion.dataaccess.common.persistence.Page;
import com.mdc.mansion.dataaccess.common.service.CrudService;
import com.mdc.mansion.dataaccess.modules.system.dao.LogDao;
import com.mdc.mansion.dataaccess.modules.system.entity.Log;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 管理员操作日志ServiceImpl
 * @author chenmingdong
 * @version 2016-03-03
 */
@Service
public class SysLogServiceImpl extends CrudService<LogDao, Log> implements SysLogService {

	public Page<Log> findPage(Page<Log> page, Log log) {
		
		// 设置默认时间范围，默认当前月
		if (log.getBeginDate() == null){
			log.setBeginDate(DateUtils.setDays(new Date(), 1));
		}
		if (log.getEndDate() == null){
			log.setEndDate(DateUtils.addMonths(log.getBeginDate(), 1));
		}
		
		return super.findPage(page, log);
		
	}
}
 